/*
 * IntervalSelector.h
 *
 *  Created on: Dec 9, 2011
 *      Author: andrea
 */

#ifndef INTERVALSELECTOR_H_
#define INTERVALSELECTOR_H_

#include <set>
#include "../../Common/Consts.h"
#include <iostream>
#include "../../Util/Util.h"

using namespace std;


class  IntervalSelector {

typedef struct IntervalStruct {
	string encodingString;
	Type start;
	Type end;
} Interval;


public:

	IntervalSelector(string attributeName, Type* points, int n);

	virtual ~IntervalSelector();

	set<string> getMatchingIntervals(Constraint constraint);

	string getMatchingIntervals(Attribute attribute);

private:

	bool overlap(Constraint constraint, Interval interval);

	bool hit(Attribute attribute, Interval interval);

	int intervalNumber;
	Interval *intervals;

	Type MINUS_INF, PLUS_INF;

};


#endif /* INTERVALSELECTOR_H_ */
